
import { serviceProto, ServiceType } from '../../shared/protocols/serviceProto';
import { Logger } from '../log/logger';
import { HttpClient } from './HttpClient';

export default class Net {

    private _http: HttpClient<ServiceType>;

    private get http() {

        let ht = this._http;

        if (ht) return ht
        // ht = this._http = new HttpClient<ServiceType>(serviceProto, {
        //     server: 'http://127.0.0.1:9001',
        //     json: true,
        //     logger: console,
        //     jsonPrune: true,
        //     timeout: 15000
        // });

        // ht.flows.preCallApiFlow.push((data) => {
        //     Logger.logNet(data, "请求前");
        //     return data;
        // })

        return ht;
    }

    // private get ws() {

    // }

    async request(...arges: Parameters<typeof this.http.callApi>) {
        // let call = this.http.callApi(...arges);
        // // let sn = this.http.lastSN;
        // return call.then(res => {
        //     // Logger.logNet(res, "请求后");
        //     return res
        // })
    }



}